<html>
<head>
<script>

if (window.testRunner) {
    testRunner.dumpAsText();
    testRunner.waitUntilDone();
}

var navigatedFrames = 0;

function checkResults()
{
    var testStatus = document.getElementById('testStatus');

    if (self.sandboxed_target.location.href.indexOf('.html') != -1)
        testStatus.innerHTML = 'FAIL: disallowed frame navigated';
    else if (navigatedFrames == 10)
        testStatus.innerHTML = 'PASS';
    else
        testStatus.innerHTML = 'FAIL: frames not navigated properly';

    if (window.testRunner)
        testRunner.notifyDone();
}

function countFrame()
{
    ++navigatedFrames;

    if (navigatedFrames == 10)
        checkResults();
}

</script>
</head>

<body>

    <p>This test verifies that a sandboxed IFrame cannot open a link in
    another frame using the <code>target</code> attribute of a link.</p>

    <p>This is done by loading ten non-sandboxed IFrames, and a single
    sandboxed one. In addition each of these frames have a target frame
    (so, 22 frames in total). Expect ten frames to be able to open a link
    in their corresponding target frame, but the sandboxed one
    to <b>not</b> be one of them.</p>
    
    <p>This test will print &quot;PASS&quot; on success.</p>

    <iframe src="resources/sandboxed-iframe-navigation-targetlink.html"
            name="f1">
    </iframe>
    <iframe name="f1_target" src="about:blank"></iframe>

    <iframe src="resources/sandboxed-iframe-navigation-targetlink.html"
            name="f2">
    </iframe>
    <iframe name="f2_target" src="about:blank"></iframe>

    <iframe src="resources/sandboxed-iframe-navigation-targetlink.html"
            name="f3">
    </iframe>
    <iframe name="f3_target" src="about:blank"></iframe>

    <iframe src="resources/sandboxed-iframe-navigation-targetlink.html"
            name="f4">
    </iframe>
    <iframe name="f4_target" src="about:blank"></iframe>

    <iframe src="resources/sandboxed-iframe-navigation-targetlink.html"
            name="f5">
    </iframe>
    <iframe name="f5_target" src="about:blank"></iframe>

    <iframe src="resources/sandboxed-iframe-navigation-targetlink.html"
            name="sandboxed"
            sandbox="allow-scripts allow-same-origin">
    </iframe>
    <iframe name="sandboxed_target" src="about:blank"></iframe>

    <iframe src="resources/sandboxed-iframe-navigation-targetlink.html"
            name="f6">
    </iframe>
    <iframe name="f6_target" src="about:blank"></iframe>

    <iframe src="resources/sandboxed-iframe-navigation-targetlink.html"
            name="f7">
    </iframe>
    <iframe name="f7_target" src="about:blank"></iframe>

    <iframe src="resources/sandboxed-iframe-navigation-targetlink.html"
            name="f8">
    </iframe>
    <iframe name="f8_target" src="about:blank"></iframe>

    <iframe src="resources/sandboxed-iframe-navigation-targetlink.html"
            name="f9">
    </iframe>
    <iframe name="f9_target" src="about:blank"></iframe>

    <iframe src="resources/sandboxed-iframe-navigation-targetlink.html"
            name="f10">
    </iframe>
    <iframe name="f10_target" src="about:blank"></iframe>

    <p id='testStatus'>FAIL: Script didn't run</p>
</body>
</html>
